package com.xlh.codeserver;

import javax.tools.JavaCompiler;
import javax.tools.ToolProvider;
import java.io.File;

public class SyntaxChecker {
    public static void main(String[] args) {
        String filename = "C:\\Users\\Administrator\\Desktop\\AnalogPartitioner.java";
        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
        int result = compiler.run(null, null, null, filename);

        if (result == 0) {
            System.out.println("Syntax is correct.");
        } else {
            System.out.println("Syntax is incorrect.");
        }
    }
}